﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DTO;
namespace DAO
{
   public class TinhTrangMayDA
    {
       public static TinhTrangMay GetByID(int maID)
       {
           TinhTrangMay loai = null;
           SqlConnection cn = DataProvider.Connect();
           SqlCommand cmd = new SqlCommand("Proc_TinhTrangMay_GetById", cn);
           cmd.CommandType = CommandType.StoredProcedure;
           cmd.Parameters.Add(new SqlParameter("@maTT", maID));
           SqlDataReader dataReader = cmd.ExecuteReader();
           if (dataReader.Read())
           {
               loai = new TinhTrangMay();
               loai.MaTT = maID;
               loai.MoTa = Convert.ToString(dataReader["MoTa"]);
               loai.LastUpdate = Convert.ToDateTime(dataReader["LastUpdate"]); 
           }
           cn.Close();
           return loai;
       }
    }
}
